package com.example.home.ScheduledCarInspection;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import com.example.home.R;
import com.example.home.ScheduledCarInspection.activity.AddappointmentActi;
import com.example.home.ScheduledCarInspection.activity.MyOrderActivity;
import com.example.home.ScheduledCarInspection.activity.VehiclemanagementActi;

public class ScheduledCarMainActivity extends AppCompatActivity {

    private ImageView but_lawyerList;
    private LinearLayout li_appointment;
    private TextView text_management;
    private TextView my_order;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scheduled_car_main);
        initview();
        //弹窗须知
        popupnotice();
        //添加预约
        addappointment();
        //车辆管理
        vehiclemanagement();
        //我的预约
        getMyOrder();
    }

    private void addappointment() {
        li_appointment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ScheduledCarMainActivity.this, AddappointmentActi.class);
                startActivity(intent);
            }
        });
    }

    private void vehiclemanagement() {
        text_management.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ScheduledCarMainActivity.this, VehiclemanagementActi.class);
                startActivity(intent);
            }
        });
    }



    private void getMyOrder() {
        my_order.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ScheduledCarMainActivity.this,MyOrderActivity.class);
                startActivity(intent);
            }
        });
    }

    private void popupnotice() {
        AlertDialog.Builder builder = new AlertDialog.Builder(ScheduledCarMainActivity.this);
        View inflate = LayoutInflater.from(ScheduledCarMainActivity.this).inflate(R.layout.item_popupnotice, null);
        builder.setView(inflate);
        builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        builder.create().show();
    }

    private void initview() {
        but_lawyerList = findViewById(R.id.but_lawyerList);
        li_appointment = findViewById(R.id.li_appointment);
        text_management = findViewById(R.id.text_management);
        my_order = findViewById(R.id.my_order);

        but_lawyerList.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ScheduledCarMainActivity.this.finish();
            }
        });
    }
}